#!/bin/sh -e

echo >&2 "Kiss 2021.7-1+ alternatives system does not play nice with busybox symlinks. As a workaround, this package removes busybox symlinks for envdir envuidgid setuidgid softlimit svc, and svok. Restoring these symlinks can be accomplished with reinstalling busybox or manually symlinking those names to the busybox binary."

echo >&2 "Continue? Press CTRL+C to quit or any key to continue."

test "$KISS_PROMPT" = "0" || read -r _ || exit 1

for i in envdir envuidgid setuidgid softlimit svc svok; do 
  $KISS_SU test -f /usr/bin/$i && $KISS_SU unlink /usr/bin/$i; 
done

sed -i '1s/-O2/$CFLAGS/' conf-cc
make

sed -i '1s/.*/\/usr\/bin/' conf-bin
sed -i '1s/.*/\/usr\/share\/man/' conf-man
make DESTDIR="$1" install
